﻿@{
    var status = new StatusMessage(TempData);
}

@if (status.Message == null)
{
    <div class="modal-dialog @ViewBag.ClassName">
        <div class="modal-content">
            <div class="modal-header">
                <h1 class="modal-title h3">@Html.Raw(ViewBag.Title)</h1>
                <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
            </div>
            <div class="modal-body">
                @RenderBody()
            </div>
            <div .visible="ViewBag.HideFooter!=true" class="modal-footer">
                @if (IsSectionDefined("footer"))
                {
                    @RenderSection("footer", false)
                }
                else
                {
                    <button type="submit" class="btn btn-primary"><i class="fa fa-check"></i> @(ViewBag.SubmitText ?? "提交")</button>
                }
            </div>
        </div>
    </div>
}
else
{
    IgnoreBody();
    var icon = status.Code == 0 ? "bi-check-circle" : "bi-exclamation-circle";
    var type = status.Code == 0 ? "success" : "danger";
    <div class="modal-dialog alert-dialog modal-dialog-centered">
        <div class="modal-content">
            <div class="modal-body row text-@type"><div class="col-sm-2 icon"><i class="fa @icon"></i></div> <span class="col-sm-10 txt"> @Html.Raw(status.Message) </span></div>
            <div class="modal-footer"><button type="button" class="btn btn-@type" data-bs-dismiss="modal"> 确认 </button></div>
        </div>
    </div>
}